package Controller;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class TestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
        ServletContext context = req.getServletContext();

        System.out.println("TestServlet context.setAttribute(\"test\",\"123\");");
        context.setAttribute("test","123");

        System.out.println("TestServlet context.setAttribute(\"test\",\"456\");");
        context.setAttribute("test","123");

        System.out.println("TestServlet context.removeAttribute(\"test\");");
        context.removeAttribute("test");

    }
}
